UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I2D6qkSnsWER0zrYiWRe1Ka28LNDqH3uE4+TKNIMMs4=' 
WHERE 
  key_id = '59d5536c06e8eb05465744571a08ce61854faf5832df22889ddb7cdbb476113f' 
  AND (
    token = 'I2D6qkSnsWER0zrYiWRe1Ka28LNDqH3uE4+TKNIMMs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040