UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OUhEn4GrwCV8flAenJhqh5vsQcDGh3OfOiLSjb7IbD8=' 
WHERE 
  key_id = 'b1bc9369b8b4b39cc9a0e666e12a78e3d81318abb37b145699478bcef9a62476' 
  AND (
    token = 'OUhEn4GrwCV8flAenJhqh5vsQcDGh3OfOiLSjb7IbD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019