UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tXWPSIxk89uqtx+h1L/urPpu9xIQxifqpLSf4oNRX3o=' 
WHERE 
  key_id = '8305c12c29a769474a1f20f864351c10eb7f9807e687327cbc9dedb034668c55' 
  AND (
    token = 'tXWPSIxk89uqtx+h1L/urPpu9xIQxifqpLSf4oNRX3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045