UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'keCIQ2kr6QdZguX7pLwJi97OUM4946VvvZmLksAdtQ8=' 
WHERE 
  key_id = '0d94dc9a28442886519bcfc4b5fd95ba6f226961c947287ac5839d06de5f724f' 
  AND (
    token = 'keCIQ2kr6QdZguX7pLwJi97OUM4946VvvZmLksAdtQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017