UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r33PU3LKbzvOXczsb4030qRYuB0IxuWq+5CSvs3UEm0=' 
WHERE 
  key_id = '1ef686ffff300169b2ef52d4211e1b6eec5a1a26dc01fa648546c21c6993e270' 
  AND (
    token = 'r33PU3LKbzvOXczsb4030qRYuB0IxuWq+5CSvs3UEm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038