UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLpzwp1HSQjrUPcphvRVNn5PLr5m2pOl9+rGtEAKXOM=' 
WHERE 
  key_id = '1a442679c25ce65dc6188095f3807b36ae1a95387f6969f8cbcb9296c5e03d9a' 
  AND (
    token = 'pLpzwp1HSQjrUPcphvRVNn5PLr5m2pOl9+rGtEAKXOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029