UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J+TB1fJ9Ix3MzykwcbkxneknCzyM2kM9npiNfk+XOWQ=' 
WHERE 
  key_id = 'fca36d744f09d45aaf3cb2054780497b9143f03c274bf272ec81f466d3edfea1' 
  AND (
    token = 'J+TB1fJ9Ix3MzykwcbkxneknCzyM2kM9npiNfk+XOWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036