UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D81tfaOiRdT5LqAh91YFdg09wu1aN1pFD5tMPkr1Z3A=' 
WHERE 
  key_id = '739158ec4fc674184795f3fc096878e63b6a59937a6226c223d1ce1700bcd8b1' 
  AND (
    token = 'D81tfaOiRdT5LqAh91YFdg09wu1aN1pFD5tMPkr1Z3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034