UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Te4CnyY0sJnkzSLyIz5m8/rhlmrarCj5Ghhc9d5sC2o=' 
WHERE 
  key_id = '9d7aa1502171e4e5b6f3c1b46d691c16abd528d512fc0efdcac2d8fbb349a97f' 
  AND (
    token = 'Te4CnyY0sJnkzSLyIz5m8/rhlmrarCj5Ghhc9d5sC2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026