UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm1FYcIuV0hKhOqGm7+jvZG+fQpfuezaWDH/D7Rjs73A=' 
WHERE 
  key_id = '57b3fb4094b46e04fdc2bdd882d9187bd29b02aa955e385f18d8124a20aad79a' 
  AND (
    token = 'm1FYcIuV0hKhOqGm7+jvZG+fQpfuezaWDH/D7Rjs73A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026