UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '23bGvgh54Dox/+3rHkxx9Dkc/M1kYMTyLr2gN4DpjLU=' 
WHERE 
  key_id = '062b12d2e143a0abbf61791137530127fb46b5d936593617a27922723ceeb3d8' 
  AND (
    token = '23bGvgh54Dox/+3rHkxx9Dkc/M1kYMTyLr2gN4DpjLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038