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

Query time 0.00190