UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q12GsQ61Z4AKxL00/wdH3bKLS3GBv0A7Km9kYN4f7v4=' 
WHERE 
  key_id = '66c17e4058185ee0c2f9cd37e669b9ee9830470db5489b88062d1e996188066d' 
  AND (
    token = 'Q12GsQ61Z4AKxL00/wdH3bKLS3GBv0A7Km9kYN4f7v4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029