UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8//4qX3AH8gdu/nXdMgNcKWp8OqXErPzaJM8KYL+F4o=' 
WHERE 
  key_id = '586d2402c3085af95937ffb15f68933a7db3a8088b691e8c5dd6920907bf3047' 
  AND (
    token = '8//4qX3AH8gdu/nXdMgNcKWp8OqXErPzaJM8KYL+F4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033