UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QsZ7RqOqKTCKp0BMC8hgpK9gKYV/tIpksTlTnRkjn1k=' 
WHERE 
  key_id = '2b14700b8663ad31c7153efce849b370e58f7f6745a0ce45221afc8952b3aa2e' 
  AND (
    token = 'QsZ7RqOqKTCKp0BMC8hgpK9gKYV/tIpksTlTnRkjn1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036