UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pRCddVIn8lG5b9tqfM0EHgogWvc/idjweHVFvcVooHE=' 
WHERE 
  key_id = 'e7a735a093bcdb7012d6037e46236dd5dbf57a9edbd4464f39b0a9937bf6b9ec' 
  AND (
    token = 'pRCddVIn8lG5b9tqfM0EHgogWvc/idjweHVFvcVooHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021