UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Akr6Oz2WzMPeUIPyV7Bs06fJTxONVioyS6q6guYmPs4=' 
WHERE 
  key_id = '830342f31cf69f8fca691b4a784801c395fb796f4734c78501b5da828ca54c9c' 
  AND (
    token = 'Akr6Oz2WzMPeUIPyV7Bs06fJTxONVioyS6q6guYmPs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034