UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2D0VfRfJ7eW4BD0MT17l4MXW7DlC/lLlQTV8/8Vj9x0=' 
WHERE 
  key_id = '3809e81d2ad1d945367bd061700e174a3682dfba9b3fa5bb211376a314f88c70' 
  AND (
    token = '2D0VfRfJ7eW4BD0MT17l4MXW7DlC/lLlQTV8/8Vj9x0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030