UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8mek9Va5wg63yzkNu4MBj+eRULRaQcV3FrlylpQE+GI=' 
WHERE 
  key_id = 'de25e073beeac2796e93243556b0992c84c20a2623fb78779004ad57fed2ad2b' 
  AND (
    token = '8mek9Va5wg63yzkNu4MBj+eRULRaQcV3FrlylpQE+GI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032