UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l/MtLEXPFFNs0U0WMMRRt/XxnIvaUpGzlEFuv8MpO9A=' 
WHERE 
  key_id = '48a781cd59f696ea887d866b59049715e3f38057f2c7e05d50d765d501354559' 
  AND (
    token = 'l/MtLEXPFFNs0U0WMMRRt/XxnIvaUpGzlEFuv8MpO9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026