UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ftnBL6xj6NQE3C9FrBcYY4tFGzCrHf72aiCuVgZg+m8=' 
WHERE 
  key_id = '4221a1f20d045e871fa61c75b3c2b5b0e0662e6ba879054108436b3391ed3f38' 
  AND (
    token = 'ftnBL6xj6NQE3C9FrBcYY4tFGzCrHf72aiCuVgZg+m8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033