UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfDhzwbR/0NVwX5Ft6P/TuWjENbGA0L0m57uB59cm5U=' 
WHERE 
  key_id = '2795e6cef1d8a3c0ed49bbae89dc9e887a2eeac68f140c7426b0bcff6259057a' 
  AND (
    token = 'qfDhzwbR/0NVwX5Ft6P/TuWjENbGA0L0m57uB59cm5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035