UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oijb9XcCixD7oaGpXmcYd594wSSaP0dSQT5eFk7qtdk=' 
WHERE 
  key_id = '786c55fb71dadc079b3558891b9f626120ad6d7b006b41e30c206073dd524c6d' 
  AND (
    token = 'oijb9XcCixD7oaGpXmcYd594wSSaP0dSQT5eFk7qtdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039