UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '//M9Eu+Y0t4P8/fGSnwL4P/1ivJ9idjkDF1+igbMfb0=' 
WHERE 
  key_id = '821dffda15d9d934202047f6672a3725710ec60bbeba834013b8091e935714ea' 
  AND (
    token = '//M9Eu+Y0t4P8/fGSnwL4P/1ivJ9idjkDF1+igbMfb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023