UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDT8mozypk/tfZT3b+P0nP8G+RkURSZ4C+REclirCa4=' 
WHERE 
  key_id = '8cbd2eadf4b1c6fff37c0d7dc9953aec660f61ce4f25e13fc39047759fd1883e' 
  AND (
    token = 'YDT8mozypk/tfZT3b+P0nP8G+RkURSZ4C+REclirCa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029