UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOFZQSn0Jw7ahWN9PDgnp4whQUIKzzFR0t9gTg3Ko4s=' 
WHERE 
  key_id = '1b2e08d0b3b11575e2836b01c2e50893b0449c48c97d900b450bdc22b176243e' 
  AND (
    token = 'hOFZQSn0Jw7ahWN9PDgnp4whQUIKzzFR0t9gTg3Ko4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030