UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UrmtMVEVT+gHDtDHQGWrpkRhq2A2HRpTPQP+q7x1Jig=' 
WHERE 
  key_id = '96d4038d66d7854bad6bf78c210dca87f37cea0ec4472ae0b5df21081f3e5277' 
  AND (
    token = 'UrmtMVEVT+gHDtDHQGWrpkRhq2A2HRpTPQP+q7x1Jig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046