UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OY9oTH7r1S35ODaem/c1XbrnNE2u56QIEeG8wkCiKxU=' 
WHERE 
  key_id = '1fbfab91b3bc86b5e2db6ab71cf00d5164842fa8a56ac1abca307ee0c4e70743' 
  AND (
    token = 'OY9oTH7r1S35ODaem/c1XbrnNE2u56QIEeG8wkCiKxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030