UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoGItbFc5HDq8/syXlCEqV/mYUQWi+TMLrul0F53634=' 
WHERE 
  key_id = '21d708704d1b4479e535977c47e39b9edf136920996757c054861da8970903db' 
  AND (
    token = 'UoGItbFc5HDq8/syXlCEqV/mYUQWi+TMLrul0F53634=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054