UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJbczd67KkwryuJqyQIUit97QbiCTC+8/B81wplrUhg=' 
WHERE 
  key_id = '881d8e56c99a875b6a1b4df2049b551d13583eb67ca68b99e8307d6c0f7c5f61' 
  AND (
    token = 'IJbczd67KkwryuJqyQIUit97QbiCTC+8/B81wplrUhg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023