UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J90dg5zzNeFCZkr9v5kMJYBY0ShSJ59AcXpJ9MiG3X4=' 
WHERE 
  key_id = '832891e3d258bfeada2331d045588a1b5fd11afc1fb8e8f66dc2e8cdfe8b413f' 
  AND (
    token = 'J90dg5zzNeFCZkr9v5kMJYBY0ShSJ59AcXpJ9MiG3X4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051