UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UNdoDHXKlojOF/Xg5aOppJvnxzy5EIuGngXsOhS0KQ8=' 
WHERE 
  key_id = 'b3f27b33d78790bc4738827a9a19a939161d7eebde946e2c7031bd9e0a3000de' 
  AND (
    token = 'UNdoDHXKlojOF/Xg5aOppJvnxzy5EIuGngXsOhS0KQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036