UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OkKUHKivHDiK0aAv5wlXn6SsJLUx+ogP5byWRI+Wtck=' 
WHERE 
  key_id = 'e4c51960fbae36b0c236229b90ad53ebd09a1313f47d0874434bdcc677602838' 
  AND (
    token = 'OkKUHKivHDiK0aAv5wlXn6SsJLUx+ogP5byWRI+Wtck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033